package com.leyou.common.enums;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
public enum ExceptionEnum {

    CATEGORY_NOT_FOUND(404, "商品分类没有找到!"),
    BRAND_NOT_FOUND(404, "商品品牌没有找到!"),
    INTERNAL_SERVER_ERROR(500, "新增商品失败!"),
    FILE_UPLOAD_EXCEPTION(500, "文件上传异常"),
    FILE_TYPE_NOT_MATCH(500, "文件类型不匹配"),
    FILE_CONTEXT_NOT_MATCH(500, "文件已损坏"),
    SPEC_GROUP_NOT_FOUND(404, "该分类下的规格组尚未找到"),
    SPEC_PARAM_NOT_FOUND(404, "该规格组下的规格参数尚未找到"),
    INSERT_SPEC_GROUP_ERROR(500, "新增规格组失败"),
    UPDATE_SPEC_GROUP_ERROR(500, "修改规格组失败"),
    DELETE_SPEC_GROUP_ERROR(500, "删除规格组失败"),
    QUERY_SPU_ERROR(404, "商品列表没有找到"),
    INSERT_SPEC_PARAM_ERROR(500, "新增规格参数失败"),
    UPDATE_SPEC_PARAM_ERROR(500, "修改规格参数失败"),
    DELETE_SPEC_PARAM_ERROR(500, "删除规格参数失败"),
    CATEGORY_BRAND_NOT_FOUND(404, "该分类下的品牌没有找到"),
    INSERT_SKU_ERROR(500, "新增sku失败"),
    QUERY_SPU_DETAIL_NOT_FOUND(404, "商品spu详情没有找到"),
    QUERY_SKU_NOT_FOUND(404, "商品sku没有找到"),
    QUERY_STOCK_NOT_FOUND(404, "商品库存查询失败"),
    GOOD_ID_NOT_EMPTY(500, "商品id不能为空"),
    INVALID_DATA_TYPE(400, "无效的参数类型"),
    INVALID_PHONE_NUMBER(400, "手机号码格式不正确"),
    INVALID_VERIFY_CODE(400, "无效的验证码"),
    INVALID_USERNAME_PASSWORD(400, "用户名或密码错误"),
    UNAUTHORIZED(403, "未授权"),
    CART_NOT_FOUND(404, "购物车未找到!"),
    CREATE_ORDER_ERROR(500, "创建订单失败"),
    CREATE_ORDER_DETAIL_ERROR(500, "创建订单详情失败"),
    CREATE_ORDER_STATUS_ERROR(500, "创建订单状态失败"),
    STOCK_NOT_ENOUGH_ERROR(500, "创建订单状态失败"),
    ORDER_NOT_FOUND(404, "订单没有找到"),
    ORDER_DETAIL_NOT_FOUND(404, "订单详情没有找到"),
    ORDER_STATUS_NOT_FOUND(404, "订单状态没有找到"),
    WX_CREATE_ORDER_ERROR(500, "微信统一下单失败"),
    WX_SIGNATURE_VALID(500, "微信签名无效"),
    COMMON_ERROR(0, ""),
    ORDER_STATUS_INVALID(500, "无效的订单状态"),
    INVALID_ORDER_PARAM(500, "无效的订单参数"),
    UPDATE_ORDER_STATUS_ERROR(500, "修改订单状态失败"),
    ;

    private Integer status;
    private String message;

    public Integer getStatus() {
        return this.status;
    }

    public String getMessage() {
        return this.message;
    }

    public ExceptionEnum init(Integer code, String msg) {
        this.status = code;
        this.message = msg;
        return this;
    }
}
